<template>
	<!-- 顶部导航栏 -->
	<view class="box cu-item">
		<view class="top-cont"></view>
		<view class="set flex justify-between padding-sm align-center">
			<text @click="handleback" style="font-size: 25px;" class="cuIcon-close"></text>
			<text style="font-size: 20px;">【{{title}}】</text>
			<text style="font-size: 20px;"></text>
		</view>
	</view>
	<view >
		<view class="text-center">
		
			<view v-for="(item) in publishlist" class=" margin-top-lg">
				<custom-card :data="item"></custom-card>
			</view>
			<text class="text-gray margin-top-lg">---end---</text>
		
		</view>
	</view>
</template>

<script setup lang="ts">
import { onLoad } from '@dcloudio/uni-app';
import { useCounterStore } from '../../store/counter';
import http from '../../utils/http';
import { ref } from 'vue';
import	type { Post } from '../../model/goods';
const counter=useCounterStore()
enum state{
	'发表'=0,
	'订阅'=1,
	'读者'=2,
	'获赞'=3
}
let title=ref<string>('')
let publishlist=ref<Post[]>([])
//返回
	const handleback = () => {
		uni.navigateBack({
			delta: 1
		})
	}
onLoad( async(postion)=>{
	console.log(postion.indx);
	title.value=state[postion.indx]
	if(postion.indx=='0'){
		let res = await http.get('classes/goods',{
			params:{
				where:{
					"userid":counter.userData.objectId
				}
			}
		})
		console.log(res);
		publishlist.value=[...res.data.results]
	}else{
		console.log('不是number');
	}
	
})
</script>

<style lang="scss">
page {
		background-color: #fff;
	}

	.box {
		position: sticky;
		top: 0;
		z-index: 777;
		background-color: white;

		.top-cont {
			height: 35px;
		}
	}       
</style>
